class String

  def palindrome?(case_matters=false)
    s = self.gsub(/[^a-zA-Z]/, '')
    return s == s.reverse!() if case_matters
    return s.downcase!() == s.reverse() if not case_matters
  end

end

puts "A man, a plan, a canal, Panama".palindrome?(false)
